if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
    # Django 4.0+ 中staticfiles标签位置变化
    try:
        from django.contrib.staticfiles.templatetags.staticfiles import static
    except ModuleNotFoundError:
        try:
            from django.templatetags.static import static
        except ImportError:
            from django.contrib.staticfiles.storage import staticfiles_storage
            def static(path):
                return staticfiles_storage.url(path)
else:
    from django.templatetags.static import static